home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / utility / 95 / general / dskusage.doc < prev    next >
Encoding:
Text File  |  1987-01-15  |  2.8 KB  |  59 lines

  1.  
  2. While researching the prospects of disk-caching on the ST I wrote a little
  3. program that makes a record of all the calls to rwabs().  Looking at the
  4. recordings I found some interesting bits of information:
  5.  
  6. When TOS accesses the boot sector, it reads TWO sectors.  I don't know why,
  7. the second sector is part of the (first) FAT, and the (second) FAT is read
  8. separately.
  9.  
  10. The FAT (logical sectors 6-10) and root directory (11-17) are read on an
  11. incremental basis, one sector at a time and only as far as necessary at the
  12. moment.
  13.  
  14. Sometimes TOS reads the first directory sector (#11) twice in succession.
  15. I suspect the first time is to look at the disk ID.  Inefficiency...
  16.  
  17. The last sector to be written in a file is read first, then written -
  18. presumably to enable partial overwriting of a file, but it's useless when
  19. simply copying a complete file...
  20.  
  21. When a disk's desktop window is closed and reopened, the boot sector (#0)
  22. is read, even if the disk was not removed. (That sector holds the info
  23. as to whether the disk is double-sided, etc.)  If you just hit <ESC>
  24. the disk turns (the root directory is re-read) but the boot sector is
  25. NOT read, unless the disk has been removed!
  26.  
  27. When you drag an icon to copy a file, a LONG sequence of calls to rwabs()
  28. occurs.  Here is an example, copying a 4-sector (2K) file from D: to A:,
  29. overwriting an old version of it on the floppy:  (R/W for read/write,
  30. A/D for the drives, then sector numbers in HEX)
  31.  
  32.         RDB RAB RAB RAC RAD RAB RAC RAD RA7 WA7 WA2 WAD WAD
  33.         RD<2 data sectors> RD6 RD<2 data sectors> RD6 RD7
  34.         WA<3 data sectors> RA<1 sector> (read-before write)
  35.         RAD WA7 WA2 WAD WA<last data sector> RAD WAD RDB
  36.  
  37. AMAZING, isn't it?  Now I wonder how come you swap disks only twice!
  38. Notice also how many track repositionings you can save by just caching
  39. sectors 6...13 there.  BTW, one "cc" command (using uCsh and Megamax
  40. to compile a SMALL program) caused 175 calls to rwabs(), of which 22
  41. were for FAT or root-directory sectors (even though all the programs
  42. invoked were in a subdirectory).
  43.  
  44. In the process of reading a file, TOS will read many consecutive sectors
  45. with ONE call to rwabs() - but will sometimes read several in separate
  46. calls, even though they ARE consecutive!  I don't see the method there,
  47. although a given file from a given disk is always read the same way.
  48.  
  49. A note about micro-C-Shell:  It never reads the boot sector via rwabs(),
  50. even when a DS disk is replaced by a SS one.  It MUST be reading it
  51. directly, e.g. using floprd().  It DOES read the first directory sector
  52. (#11), via rwabs(), and TWICE (as mentioned above).
  53.  
  54. Hope this helps you understand TOS a little bit better.
  55. (If you experts knew all of this all along, than why didn't you tell us?? :-)
  56. The program I used is available upon request.
  57.  
  58. - Moshe Braner
  59.